﻿#Region "Copyright/License"

'  Copyright (C) 2011, 2012, 2013 Paycircuit.com, Thinking Spot, Ed Chavez
'  http://goo.gl/jty8r
' 
'  Licensed under the Apache License, Version 2.0 (the "License");
'  you may not use this file except in compliance with the License.
'  You may obtain a copy of the License at
' 
'       http://www.apache.org/licenses/LICENSE-2.0
' 
'  Unless required by applicable law or agreed to in writing, software
'  distributed under the License is distributed on an "AS IS" BASIS,
'  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
'  See the License for the specific language governing permissions and
'  limitations under the License.

#End Region


Imports System.Runtime.Serialization

Namespace google.iap

    <DataContract()>
    Public Class InAppSubscriptionRecurrenceObject
        Inherits SubscriptionPaymentObject

#Region "Defaults"

        Private _recurrenceStartDate As DateTime?
        Private _startTime As Integer?

#End Region

        ''' <summary>
        ''' Optional: Time in seconds from epoch to start recurring the charge. The first recurrence will occur at the time specified in this field.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        <DataMember(isRequired:=False, EmitDefaultValue:=False, Order:=3)>
        Public Property startTime As Integer?
            Get
                If Me._recurrenceStartDate.HasValue Then
                    Return dateToEpochTime(CDate(Me._recurrenceStartDate))
                End If
            End Get
            Private Set(ByVal value As Integer?)
                Me._startTime = value
            End Set
        End Property

        ''' <summary>
        ''' Set this value only if defining subscription recurrence start date.
        ''' </summary>
        ''' <value></value>
        ''' <remarks></remarks>
        Public WriteOnly Property recurrenceStartDate As DateTime?
            Set(value As DateTime?)
                Me._recurrenceStartDate = value
            End Set
        End Property

        ''' <summary>
        ''' Indicates the frequency of the recurrence - e.g. monthly
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks>The current supported frequency is "monthly".</remarks>
        <DataMember(isRequired:=True)>
        Public Property frequency As String

        ''' <summary>
        ''' Number of times to recur the charge. Integer in string format - e.g. "12"
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        <DataMember(isRequired:=False, EmitDefaultValue:=False)>
        Public Property numRecurrences As String


        Public Sub New()
        End Sub



    End Class

End Namespace
